<div id="sms_in_ildds" class="easyui-layout tab_a" fit="true">
    <div data-options="region:'center',border:false">
        <table id="sms_in_list"></table>
        <div id="smsinboxtoolbar" style="padding:5px;height:auto">
            <div>
                <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-remove" plain="true" onclick="delsmsInbox()">删除</a>
                <label style=" float:right;" >
                    	<input id="sms_in_search_key" class="sms_in_search_form textbox" style="width:200px;" type="text">
                    	<a href="#" class="easyui-linkbutton sms_in_search_form" plain="true"  iconCls="icon-search" onclick="advanced_search('sms_in','sms_in_search_key')">搜索</a>
                    <a id="sms_in_advancedSearch" href="javascript:void(0)" class="easyui-linkbutton" plain="true" onclick="advanced_search('sms_in','高级')">高级</a>
                    
                </label>
            </div>
        </div>
	</div>
</div>
<script>

//收短信数据构造方法，包括列表属性设置，字段设置，双击设置
$('#sms_in_list').datagrid({
    url:'<?php echo base_url('sms/inbox_data');?>',
	singleSelect:true,
	selectOnCheck:false,
	pagination:true,
	pageSize:30,
	pageList:[30,50,100],
	fit:true,
	fitColumns:true,
	border:false,
	queryParams:{},
	sortName:'bodyid',
	sortOrder:'desc',
	toolbar:'#smsinboxtoolbar',
    columns:[[
		{field:'id',checkbox:true},
		{field:'smstype',title:'类型',width:10,align:'center',
			formatter: function(value,row,index){
				switch(parseInt(value)){
				case 0:
					return "<div class='icon-sound' style='height: 16px;'></div>";	
					break;
				case 2:
					return "<div class='icon-email' style='height: 16px;'></div>";	
					break;
				default:
					return "<div class='icon-sound' style='height: 16px;'></div>";	
				}				
			}
		},
        {field:'sender',title:'发信人',width:16,align:'center'},
        {field:'title',title:'内容',width:200},
        {field:'sendertime',title:'发信时间',width:30,align:'center',sortable:'true',
			formatter: function(value,row,index){
				//return getLocalTime(value);
				return value;
			}
		}
    ]],
	onLoadSuccess:function(){
        var pager = $(this).datagrid('getPager');
        pager.pagination({
            displayMsg: '当前显示 {from} - {to} 条记录   共 {total} 条记录'
        });
    }
});


//"删除"动作函数
function delsmsInbox(){
	var getobj = $('#sms_in_list').datagrid("getChecked");
	var getid = [];
		$.each(getobj, function(index, item){
			getid.push(item.id);
		}); 
	if(getid.length == 0){
		$.messager.alert('提示','要删除邮件，请选取要操作的行','warning');
	}else{
		$.messager.confirm('提示', '确定要删除选中的邮件吗?', function(r){
			if(r){
				$.post("<?php echo base_url('sms/inbox_del');?>",{getid:getid},function(result){
					if(result.success){
						$('#sms_in_list').datagrid('reload');
					}else{
						$.messager.alert('错误',result.errorMsg,'error');
					}
				},'json');
			}
		});	
	}
}


</script>